namespace BuildServer.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class BuildRun : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.BuildRuns",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Start = c.DateTime(),
                        End = c.DateTime(),
                        BuildDefinition_Id = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.BuildDefinitions", t => t.BuildDefinition_Id, cascadeDelete: true)
                .Index(t => t.BuildDefinition_Id);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.BuildRuns", new[] { "BuildDefinition_Id" });
            DropForeignKey("dbo.BuildRuns", "BuildDefinition_Id", "dbo.BuildDefinitions");
            DropTable("dbo.BuildRuns");
        }
    }
}
